//
//
//
// MY MODEL OBJECT FOR SHOPPING LIST
//
// 

#import "ShoppingListItem.h"


@implementation ShoppingListItem


-(void)setItemName:(NSString *)newName
{
    [itemName release];
    
    itemName = [newName retain];
}


-(NSString *)itemName
{
    return itemName;
}

-(void)setQuantity:(int)newQuantity
{
    quantity = newQuantity;
}


-(int)quantity
{
    return quantity;
}


-(id)initWithName:(NSString *)newName quantity:(int)newQuantity
{
    if(self == [super init])
    {
        itemName = [newName retain];
        quantity = newQuantity;
    }
    return self;
}


+(id)shoppingListItemsWithName:(NSString *)newName quantity:(int)newQuantity
{
    return [[[ShoppingListItem alloc]
             initWithName:newName quantity:newQuantity] autorelease];
}


-(id)init
{
    return [self initWithName:@"Bread" quantity:1];
}


-(void)dealloc
{
    [itemName release];
    
    [super dealloc];
}

@end
